package org.spring.springboot.domain;

import java.util.Date;
import java.util.Objects;

import org.json.JSONObject;

public class User {
    public User(String userid, String uname, String phoneNum, Date regDate) {
        this.userid = userid;
        this.uname = uname;
        this.phoneNum = phoneNum;
        this.regDate = regDate;
    }

    public User() {
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        User user = (User) o;
        return Objects.equals(userid, user.userid) && Objects.equals(uname, user.uname) && Objects.equals(phoneNum, user.phoneNum) && Objects.equals(regDate, user.regDate);
    }

    @Override
    public int hashCode() {
        return Objects.hash(userid, uname, phoneNum, regDate);
    }

    public String getUserid() {
        return userid;
    }

    public void setUserid(String userid) {
        this.userid = userid;
    }

    public String getUname() {
        return uname;
    }

    public void setUname(String uname) {
        this.uname = uname;
    }

    public String getPhoneNum() {
        return phoneNum;
    }

    public void setPhoneNum(String phoneNum) {
        this.phoneNum = phoneNum;
    }

    public Date getRegDate() {
        return regDate;
    }

    public void setRegDate(Date regDate) {
        this.regDate = regDate;
    }

    private String userid;
    private String uname;
    private String phoneNum;
    private Date   regDate;

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    private String password;

    public JSONObject toJson(){
        JSONObject obj = new JSONObject();
        obj.put("userid",this.userid);
        obj.put("uname",this.uname);
        obj.put("phoneNum",this.phoneNum);
        obj.put("regDate",this.regDate);
        obj.put("password",this.password);
        return obj;
    }
}
